//
//  XXJLoginViewController.m
//  gosh
//
//  Created by 许小军 on 16/9/23.
//  Copyright © 2016年 wyzc. All rights reserved.
//

#import "XXJLoginViewController.h"
#import "MiddleView.h"
#import "FastLoginView.h"
@interface XXJLoginViewController ()
@property (weak, nonatomic) IBOutlet UIView *middleView;
@property (weak, nonatomic) IBOutlet UIView *bottomView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *leadCons;

@end

@implementation XXJLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    MiddleView * loginView=[MiddleView loginView];
    [self.middleView addSubview:loginView];
    
    MiddleView * registView=[MiddleView registView];
    [self.middleView addSubview:registView];
    
    
    FastLoginView * fastLoginView=[FastLoginView fastLogin];
    [self.bottomView addSubview:fastLoginView];
}

-(void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];
    
    
    MiddleView * login=self.middleView.subviews[0];
    login.frame=CGRectMake(0, 0, self.middleView.cur_w/2, self.middleView.cur_h);
    
    MiddleView * regist=self.middleView.subviews[1];
    regist.frame=CGRectMake(self.middleView.cur_w/2, 0, self.middleView.cur_w/2, self.middleView.cur_h);
    
    FastLoginView * fast=self.bottomView.subviews[0];
    fast.frame=self.bottomView.bounds;
    
}

- (IBAction)close:(UIButton *)sender
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)regist:(UIButton *)sender
{
    sender.selected=!sender.selected;
    
    //平移中间的view
    _leadCons.constant=_leadCons.constant ==0?-self.middleView.cur_w/2 :0;
    [UIView animateWithDuration:0.3 animations:^{
        [self.view layoutIfNeeded];
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
